<template>
  <div class="box-card info-window">
    <div class="info-window-header">
      <div>{{markerInfo.name}}</div>
      <div><i class="el-icon-close"
           @click="closeWindow()"></i></div>
    </div>
    <div class="info-window-content">
      <div>
        经度：{{markerInfo.longitude}}
      </div>
      <div>
        纬度：{{markerInfo.latitude}}
      </div>
    </div>
    <div class="infowindow-tip-container">
      <div class="infowindow-tip"></div>
    </div>
  </div>
</template>

<script>

export default {
  name: 'infoWindow',
  props: {
    infoWindow: {
      type: Object,
      default: () => { }
    },
    markerInfo: {
      type: Object,
      default: () => { }
    }
  },
  methods: {
    closeWindow () {
      this.infoWindow.close();
      this.$emit('closeInfoWindow');
    }
  }
}
</script>

<style lang="scss">
.info-window {
  width: 350px;
  background: #fff;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  .info-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 30px;
    padding: 5px 10px;
    background: #1e90ff;
    font-size: 14px;
    color: #fff;
    .el-icon-close {
      cursor: pointer;
      font-size: 18px;
    }
  }
  .info-window-content {
  }
  .infowindow-tip-container {
    margin: 0 auto;
    width: 15px;
    height: 15px;
    position: relative;
    overflow: hidden;
    pointer-events: none;
    transform: rotate(45deg) translate(5px);
    background: #fff;
    // .infowindow-tip {
    //   width: 17px;
    //   height: 17px;
    //   padding: 1px;
    //   margin: 11px auto 0;
    //   transform: rotate(45deg);
    //   background: #fff;
    // }
  }
}
</style>